package com.wit.paper.controller;

import com.wit.paper.mapper.ItemsMapper;
import com.wit.paper.mapper.UserMapper;
import com.wit.paper.model.Items;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

/**
 * Created by 何鹏帅 on 2016/11/21.
 */
@Controller
public class HomeController {

    private Logger logger = LoggerFactory.getLogger(HomeController.class);

    @Autowired
    private UserMapper userMapper;

    @Autowired
    private ItemsMapper itemsMapper;
    @RequestMapping("/")
    public String home() {
        logger.info("123345332");
        Items items =null;
        try {
            items = itemsMapper.getById(3);
        } catch (Exception e) {
            e.printStackTrace();
        }

        logger.info("" + userMapper.selectByPrimaryKey(1).getUsername());
        System.out.println(items.getName());
        return "home";
    }
}
